<?php
namespace App\Console\Commands; use Illuminate\Console\Command; class ResetPassword extends Command { protected $signature = 'reset:password {email} {password}'; protected $description = 'Reset the password of user
Usage: php artisan reset:password user@email.com'; public function __construct() { parent::__construct(); } public function handle() { $sp82cba2 = $this->argument('email'); if (!$sp82cba2) { $this->warn('please input the user\'s email
'); return false; } $sp766bcc = \App\User::where('email', $sp82cba2)->first(); if (!$sp766bcc) { $this->warn("can't find the user: {$sp82cba2} \nplease input the user's email\n"); return false; } $spc3374e = $this->argument('password'); $sp766bcc->password = bcrypt($spc3374e); $sp766bcc->save(); $this->info("the password of '{$sp82cba2}' has been set to {$spc3374e}\n"); return true; } }